package com.stgy.lease.web.admin.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * ClassName:StgyWebMvcConfig
 * Package:com.stgy.lease.web.admin.config
 * Description:
 *
 * @Author:helei
 * @Create:2024/9/7 - 11:41
 */
@Component
public class StgyWebMvcConfig implements WebMvcConfigurer {

    //跨域配置
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**") //所有资源
//                .allowedOrigins("192.。。")
                .allowedOriginPatterns("*")//通过所有服务器
                .allowedMethods("*")//请求方式
                .allowCredentials(true)//携带的cookie
                .allowedHeaders("*");//允许携带的请求头
    }
}
